#include "events.h"
#include <QMouseEvent>
#include <QWidget>
#include <QEvent>
#include <QCursor>
#include <QPoint>
#include "mainwindow.h"

bool
Events::eventFilter(QObject* obj, QEvent* event){

    if(obj == m_parent){
        if(event->type() == QEvent::MouseMove) {
            QMouseEvent* teste = static_cast<QMouseEvent*>(event);

            QPoint mousePos = QCursor::pos();
            int x = mousePos.x();
            int y = mousePos.y();
            QString str = QString::number(x);
            str.append(",");
            str.append(QString::number(y));
            m_mainWindow->setBarLabel(str);
            return true;
        } else {

            return false;
        }
    } else {
         return QObject::eventFilter(obj, event);
    }


}
